<?php 
/*
# ------------------------------------------------------------------------
# JA Job Board Package
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
# Author: JoomlArt.com
# Websites: http://www.joomlart.com - http://www.joomlancers.com.
# ------------------------------------------------------------------------
*/

global $jbconfig;
rendfield_JS();
$remove_field_name = array('views','id','ordering');
?>
<script type="text/javascript" language="javascript">
/* <![CDATA[ */
function check(value)
	{
		attachment = document.getElementById('attachment');
		
		if (value==1)
		{
			attachment.value = '';
			attachment.disabled = true;
			
		}
		else
		{
			attachment.disabled = false;
		}
		
		
	}
/* ]]> */
</script>
<form name="adminForm" action="index.php" method="post" enctype="multipart/form-data">
	<fieldset>	
	<legend><?php echo JText::_('Application details'); ?></legend>
	<table class="admintable">
       
       
        <?php
        $k=0;
        $action = (isset($this->item->id)&&($this->item->id!=0)&&($this->item->id!=null))?'edit':'new';
        for($i = 0, $n = count($this->fieldlist); $i < $n; $i++ ){
            $field = $this->fieldlist[$i];
            $field_name = $field->field_name;
            if (in_array($field_name,$remove_field_name))
            	continue;
            $input = rendfield($this->item, $field, false, true);
            ?>           
            
            <?php //if($input!='' && $field->display!='hide_on_new'){
            	
		      		$classname = 'row'.($k);
            ?>
            <tr class="<?php echo $classname; ?>">
                <td  class="key" width="30%" valign="top">
                    <?php 
                    	echo ($field->field_name=='job_id')?JText::_('Job ID'):JText::_($field->label);                
                    ?>
                    
                </td>
                
                <td width="70%" >
                    <?php 
                    	if (substr($field_name,0,5)!="guest")
                    	{	
                        	if (($field->field_type!='FILE'))
                        		echo rendfield($this->item, $field, false, true);
                        	else 
                        	{
//	                            		
                        	echo "<div id='div_att'>";
                        		echo rendfield($this->item, $field,false,true);
                        	echo "</div>";
                        	}
                    	}
                    	elseif (getCurrentUserType()=='Guest'){
            				
                    		echo $input;
                    	}
                    		
                    ?>
                </td>
            </tr>                    
           <?php
            $k = 1 - $k;
            
        }
        ?>
        
    </table>
    </fieldset>
    <?php if (!$this->item->id)
    {
    	
    ?>
	<input type="hidden" name="created_date" value="<?php echo date('Y-m-d H:i:s'); ?>" />    
    <input type="hidden" id="attachment_resume" name="attachment_resume" value="no" />
    
    <?php 
    }
    ?>
    
	
    <input type="hidden" name="cid[]" value="<?php echo $this->item->id; ?>" />
    <input type="hidden" name="posted" value="1" />
    <input type="hidden" name="option" value="<?php echo JBCOMNAME; ?>" />
    <input type="hidden" name="view" value="jaapplications" />
    <input type="hidden" name="task" value="save_application" />
    <input type="hidden" name="menuId" value="<?php echo $this->menuId; ?>" />
    <?php echo JHTML::_( 'form.token' ); ?>    
 </form>